package com.mazaiting.manager.api;

import com.mazaiting.common.core.domain.result.Result;
import com.mazaiting.manager.api.fallback.OAuth2ClientFeignFallbackClient;
import com.mazaiting.manager.constant.ApiConstant;
import com.mazaiting.manager.dto.SysOauthClientDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * OAuth2 认证服务
 * 注：远程调用时，传入参数值大于两个必须使用@requestParam指定参数名或者使用@requestBody封装起来传送一个参数则不需要
 */
@FeignClient(value = ApiConstant.SERVICE_MANAGER, path = ApiConstant.PATH_MANAGER_OAUTH,
        contextId = ApiConstant.CONTEXT_ID_OAUTH, fallback = OAuth2ClientFeignFallbackClient.class)
public interface IOAuth2ClientFeignClient {

    /**
     * 获取 OAuth2 客户端
     * @param clientId 客户端 ID
     * @return 客户端信息
     */
    @GetMapping("getOAuth2ClientById")
    Result<SysOauthClientDTO> getOAuth2ClientById(@RequestParam String clientId);
}
